<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-2"></span><span class="hs-comment">--</span><span>
</span><span id="line-3"></span><span class="hs-comment">-- GHC Extra object linking code</span><span>
</span><span id="line-4"></span><span class="hs-comment">--</span><span>
</span><span id="line-5"></span><span class="hs-comment">-- (c) The GHC Team 2017</span><span>
</span><span id="line-6"></span><span class="hs-comment">--</span><span>
</span><span id="line-7"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-8"></span><span>
</span><span id="line-9"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.SysTools.ExtraObj</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-10"></span><span>  </span><span class="annot"><a href="GHC.SysTools.ExtraObj.html#mkExtraObj"><span class="hs-identifier">mkExtraObj</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.SysTools.ExtraObj.html#mkExtraObjToLinkIntoBinary"><span class="hs-identifier">mkExtraObjToLinkIntoBinary</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.SysTools.ExtraObj.html#mkNoteObjsToLinkIntoBinary"><span class="hs-identifier">mkNoteObjsToLinkIntoBinary</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-11"></span><span>  </span><span class="annot"><a href="GHC.SysTools.ExtraObj.html#checkLinkInfo"><span class="hs-identifier">checkLinkInfo</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.SysTools.ExtraObj.html#getLinkInfo"><span class="hs-identifier">getLinkInfo</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.SysTools.Info.html#getCompilerInfo"><span class="hs-identifier">getCompilerInfo</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-12"></span><span>  </span><span class="annot"><a href="GHC.SysTools.ExtraObj.html#ghcLinkInfoSectionName"><span class="hs-identifier">ghcLinkInfoSectionName</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.SysTools.ExtraObj.html#ghcLinkInfoNoteName"><span class="hs-identifier">ghcLinkInfoNoteName</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.SysTools.ExtraObj.html#platformSupportsSavingLinkOpts"><span class="hs-identifier">platformSupportsSavingLinkOpts</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-13"></span><span>  </span><span class="annot"><a href="GHC.SysTools.ExtraObj.html#haveRtsOptsFlags"><span class="hs-identifier">haveRtsOptsFlags</span></a></span><span>
</span><span id="line-14"></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-15"></span><span>
</span><span id="line-16"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Asm.html"><span class="hs-identifier">GHC.Utils.Asm</span></a></span><span>
</span><span id="line-17"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html"><span class="hs-identifier">GHC.Utils.Error</span></a></span><span>
</span><span id="line-18"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html"><span class="hs-identifier">GHC.Driver.Session</span></a></span><span>
</span><span id="line-19"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Unit.State.html"><span class="hs-identifier">GHC.Unit.State</span></a></span><span>
</span><span id="line-20"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../ghc-boot/src/GHC.Platform.html#"><span class="hs-identifier">GHC.Platform</span></a></span><span>
</span><span id="line-21"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html"><span class="hs-identifier">GHC.Utils.Outputable</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">Outputable</span></span><span>
</span><span id="line-22"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html"><span class="hs-identifier">GHC.Types.SrcLoc</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#noSrcSpan"><span class="hs-identifier">noSrcSpan</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-23"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Unit.html"><span class="hs-identifier">GHC.Unit</span></a></span><span>
</span><span id="line-24"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.SysTools.Elf.html"><span class="hs-identifier">GHC.SysTools.Elf</span></a></span><span>
</span><span id="line-25"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html"><span class="hs-identifier">GHC.Utils.Misc</span></a></span><span>
</span><span id="line-26"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Prelude.html"><span class="hs-identifier">GHC.Prelude</span></a></span><span>
</span><span id="line-27"></span><span>
</span><span id="line-28"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.html#"><span class="hs-identifier">Control.Monad</span></a></span><span>
</span><span id="line-29"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Maybe.html#"><span class="hs-identifier">Data.Maybe</span></a></span><span>
</span><span id="line-30"></span><span>
</span><span id="line-31"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.IO.Class.html#"><span class="hs-identifier">Control.Monad.IO.Class</span></a></span><span>
</span><span id="line-32"></span><span>
</span><span id="line-33"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.SysTools.FileCleanup.html"><span class="hs-identifier">GHC.SysTools.FileCleanup</span></a></span><span>
</span><span id="line-34"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.SysTools.Tasks.html"><span class="hs-identifier">GHC.SysTools.Tasks</span></a></span><span>
</span><span id="line-35"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.SysTools.Info.html"><span class="hs-identifier">GHC.SysTools.Info</span></a></span><span>
</span><span id="line-36"></span><span>
</span><span id="line-37"></span><span class="annot"><a href="GHC.SysTools.ExtraObj.html#mkExtraObj"><span class="hs-identifier hs-type">mkExtraObj</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#Suffix"><span class="hs-identifier hs-type">Suffix</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span>
</span><span id="line-38"></span><span id="mkExtraObj"><span class="annot"><span class="annottext">mkExtraObj :: DynFlags -&gt; String -&gt; String -&gt; IO String
</span><a href="GHC.SysTools.ExtraObj.html#mkExtraObj"><span class="hs-identifier hs-var hs-var">mkExtraObj</span></a></span></span><span> </span><span id="local-6989586621681012594"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681012594"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621681012593"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681012593"><span class="hs-identifier hs-var">extn</span></a></span></span><span> </span><span id="local-6989586621681012592"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681012592"><span class="hs-identifier hs-var">xs</span></a></span></span><span>
</span><span id="line-39"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621681012591"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681012591"><span class="hs-identifier hs-var">cFile</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; TempFileLifetime -&gt; String -&gt; IO String
</span><a href="GHC.SysTools.FileCleanup.html#newTempName"><span class="hs-identifier hs-var">newTempName</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681012594"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">TempFileLifetime
</span><a href="GHC.SysTools.FileCleanup.html#TFL_CurrentModule"><span class="hs-identifier hs-var">TFL_CurrentModule</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681012593"><span class="hs-identifier hs-var">extn</span></a></span><span>
</span><span id="line-40"></span><span>      </span><span id="local-6989586621681012588"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681012588"><span class="hs-identifier hs-var">oFile</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; TempFileLifetime -&gt; String -&gt; IO String
</span><a href="GHC.SysTools.FileCleanup.html#newTempName"><span class="hs-identifier hs-var">newTempName</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681012594"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">TempFileLifetime
</span><a href="GHC.SysTools.FileCleanup.html#TFL_GhcSession"><span class="hs-identifier hs-var">TFL_GhcSession</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;o&quot;</span></span><span>
</span><span id="line-41"></span><span>      </span><span class="annot"><span class="annottext">String -&gt; String -&gt; IO ()
</span><a href="../../base/src/System.IO.html#writeFile"><span class="hs-identifier hs-var">writeFile</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681012591"><span class="hs-identifier hs-var">cFile</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681012592"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-42"></span><span>      </span><span id="local-6989586621681012585"><span class="annot"><span class="annottext">CompilerInfo
</span><a href="#local-6989586621681012585"><span class="hs-identifier hs-var">ccInfo</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IO CompilerInfo -&gt; IO CompilerInfo
forall (m :: * -&gt; *) a. MonadIO m =&gt; IO a -&gt; m a
</span><a href="../../base/src/Control.Monad.IO.Class.html#liftIO"><span class="hs-identifier hs-var">liftIO</span></a></span><span> </span><span class="annot"><span class="annottext">(IO CompilerInfo -&gt; IO CompilerInfo)
-&gt; IO CompilerInfo -&gt; IO CompilerInfo
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; IO CompilerInfo
</span><a href="GHC.SysTools.Info.html#getCompilerInfo"><span class="hs-identifier hs-var">getCompilerInfo</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681012594"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-43"></span><span>      </span><span class="annot"><span class="annottext">Maybe ForeignSrcLang -&gt; DynFlags -&gt; [Option] -&gt; IO ()
</span><a href="GHC.SysTools.Tasks.html#runCc"><span class="hs-identifier hs-var">runCc</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe ForeignSrcLang
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681012594"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-44"></span><span>            </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><span class="annottext">String -&gt; Option
</span><a href="GHC.Utils.CliOption.html#Option"><span class="hs-identifier hs-var">Option</span></a></span><span>        </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;-c&quot;</span></span><span class="hs-special">,</span><span>
</span><span id="line-45"></span><span>              </span><span class="annot"><span class="annottext">String -&gt; String -&gt; Option
</span><a href="GHC.Utils.CliOption.html#FileOption"><span class="hs-identifier hs-var">FileOption</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;&quot;</span></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681012591"><span class="hs-identifier hs-var">cFile</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-46"></span><span>              </span><span class="annot"><span class="annottext">String -&gt; Option
</span><a href="GHC.Utils.CliOption.html#Option"><span class="hs-identifier hs-var">Option</span></a></span><span>        </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;-o&quot;</span></span><span class="hs-special">,</span><span>
</span><span id="line-47"></span><span>              </span><span class="annot"><span class="annottext">String -&gt; String -&gt; Option
</span><a href="GHC.Utils.CliOption.html#FileOption"><span class="hs-identifier hs-var">FileOption</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;&quot;</span></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681012588"><span class="hs-identifier hs-var">oFile</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-48"></span><span>              </span><span class="annot"><span class="annottext">[Option] -&gt; [Option] -&gt; [Option]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681012593"><span class="hs-identifier hs-var">extn</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">/=</span></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;s&quot;</span></span><span>
</span><span id="line-49"></span><span>                    </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">[Option]
</span><a href="#local-6989586621681012579"><span class="hs-identifier hs-var">cOpts</span></a></span><span>
</span><span id="line-50"></span><span>                    </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">CompilerInfo -&gt; [Option]
</span><a href="#local-6989586621681012578"><span class="hs-identifier hs-var">asmOpts</span></a></span><span> </span><span class="annot"><span class="annottext">CompilerInfo
</span><a href="#local-6989586621681012585"><span class="hs-identifier hs-var">ccInfo</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-51"></span><span>      </span><span class="annot"><span class="annottext">String -&gt; IO String
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681012588"><span class="hs-identifier hs-var">oFile</span></a></span><span>
</span><span id="line-52"></span><span>    </span><span class="hs-keyword">where</span><span>
</span><span id="line-53"></span><span>      </span><span id="local-6989586621681012577"><span class="annot"><span class="annottext">pkgs :: UnitState
</span><a href="#local-6989586621681012577"><span class="hs-identifier hs-var hs-var">pkgs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; UnitState
</span><a href="GHC.Driver.Session.html#unitState"><span class="hs-identifier hs-var hs-var">unitState</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681012594"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-54"></span><span>
</span><span id="line-55"></span><span>      </span><span class="hs-comment">-- Pass a different set of options to the C compiler depending one whether</span><span>
</span><span id="line-56"></span><span>      </span><span class="hs-comment">-- we're compiling C or assembler. When compiling C, we pass the usual</span><span>
</span><span id="line-57"></span><span>      </span><span class="hs-comment">-- set of include directories and PIC flags.</span><span>
</span><span id="line-58"></span><span>      </span><span id="local-6989586621681012579"><span class="annot"><span class="annottext">cOpts :: [Option]
</span><a href="#local-6989586621681012579"><span class="hs-identifier hs-var hs-var">cOpts</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(String -&gt; Option) -&gt; [String] -&gt; [Option]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; Option
</span><a href="GHC.Utils.CliOption.html#Option"><span class="hs-identifier hs-var">Option</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; [String]
</span><a href="GHC.Driver.Session.html#picCCOpts"><span class="hs-identifier hs-var">picCCOpts</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681012594"><span class="hs-identifier hs-var">dflags</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-59"></span><span>                    </span><span class="annot"><span class="annottext">[Option] -&gt; [Option] -&gt; [Option]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; Option) -&gt; [String] -&gt; [Option]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; String -&gt; Option
</span><a href="GHC.Utils.CliOption.html#FileOption"><span class="hs-identifier hs-var">FileOption</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;-I&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-60"></span><span>                            </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GenericUnitInfo
  (Indefinite UnitId)
  PackageId
  PackageName
  UnitId
  ModuleName
  (GenModule (GenUnit UnitId))
-&gt; [String]
forall compid srcpkgid srcpkgname uid modulename mod.
GenericUnitInfo compid srcpkgid srcpkgname uid modulename mod
-&gt; [String]
</span><a href="../../ghc-boot/src/GHC.Unit.Database.html#unitIncludeDirs"><span class="hs-identifier hs-var hs-var">unitIncludeDirs</span></a></span><span> </span><span class="annot"><span class="annottext">(GenericUnitInfo
   (Indefinite UnitId)
   PackageId
   PackageName
   UnitId
   ModuleName
   (GenModule (GenUnit UnitId))
 -&gt; [String])
-&gt; GenericUnitInfo
     (Indefinite UnitId)
     PackageId
     PackageName
     UnitId
     ModuleName
     (GenModule (GenUnit UnitId))
-&gt; [String]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt;
UnitState
-&gt; GenUnit UnitId
-&gt; GenericUnitInfo
     (Indefinite UnitId)
     PackageId
     PackageName
     UnitId
     ModuleName
     (GenModule (GenUnit UnitId))
UnitState
-&gt; GenUnit UnitId
-&gt; GenericUnitInfo
     (Indefinite UnitId)
     PackageId
     PackageName
     UnitId
     ModuleName
     (GenModule (GenUnit UnitId))
</span><a href="GHC.Unit.State.html#unsafeLookupUnit"><span class="hs-identifier hs-var">unsafeLookupUnit</span></a></span><span> </span><span class="annot"><span class="annottext">UnitState
</span><a href="#local-6989586621681012577"><span class="hs-identifier hs-var">pkgs</span></a></span><span> </span><span class="annot"><span class="annottext">GenUnit UnitId
</span><a href="GHC.Unit.Types.html#rtsUnit"><span class="hs-identifier hs-var">rtsUnit</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-61"></span><span>
</span><span id="line-62"></span><span>      </span><span class="hs-comment">-- When compiling assembler code, we drop the usual C options, and if the</span><span>
</span><span id="line-63"></span><span>      </span><span class="hs-comment">-- compiler is Clang, we add an extra argument to tell Clang to ignore</span><span>
</span><span id="line-64"></span><span>      </span><span class="hs-comment">-- unused command line options. See trac #11684.</span><span>
</span><span id="line-65"></span><span>      </span><span id="local-6989586621681012578"><span class="annot"><span class="annottext">asmOpts :: CompilerInfo -&gt; [Option]
</span><a href="#local-6989586621681012578"><span class="hs-identifier hs-var hs-var">asmOpts</span></a></span></span><span> </span><span id="local-6989586621681012565"><span class="annot"><span class="annottext">CompilerInfo
</span><a href="#local-6989586621681012565"><span class="hs-identifier hs-var">ccInfo</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-66"></span><span>            </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">(CompilerInfo -&gt; Bool) -&gt; [CompilerInfo] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#any"><span class="hs-identifier hs-var">any</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CompilerInfo
</span><a href="#local-6989586621681012565"><span class="hs-identifier hs-var">ccInfo</span></a></span><span> </span><span class="annot"><span class="annottext">CompilerInfo -&gt; CompilerInfo -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span class="hs-special">)</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">CompilerInfo
</span><a href="GHC.Driver.Session.html#Clang"><span class="hs-identifier hs-var">Clang</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CompilerInfo
</span><a href="GHC.Driver.Session.html#AppleClang"><span class="hs-identifier hs-var">AppleClang</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CompilerInfo
</span><a href="GHC.Driver.Session.html#AppleClang51"><span class="hs-identifier hs-var">AppleClang51</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-67"></span><span>                </span><span class="hs-keyword">then</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">String -&gt; Option
</span><a href="GHC.Utils.CliOption.html#Option"><span class="hs-identifier hs-var">Option</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;-Qunused-arguments&quot;</span></span><span class="hs-special">]</span><span>
</span><span id="line-68"></span><span>                </span><span class="hs-keyword">else</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-69"></span><span>
</span><span id="line-70"></span><span class="hs-comment">-- When linking a binary, we need to create a C main() function that</span><span>
</span><span id="line-71"></span><span class="hs-comment">-- starts everything off.  This used to be compiled statically as part</span><span>
</span><span id="line-72"></span><span class="hs-comment">-- of the RTS, but that made it hard to change the -rtsopts setting,</span><span>
</span><span id="line-73"></span><span class="hs-comment">-- so now we generate and compile a main() stub as part of every</span><span>
</span><span id="line-74"></span><span class="hs-comment">-- binary and pass the -rtsopts setting directly to the RTS (#5373)</span><span>
</span><span id="line-75"></span><span class="hs-comment">--</span><span>
</span><span id="line-76"></span><span class="hs-comment">-- On Windows, when making a shared library we also may need a DllMain.</span><span>
</span><span id="line-77"></span><span class="hs-comment">--</span><span>
</span><span id="line-78"></span><span class="annot"><a href="GHC.SysTools.ExtraObj.html#mkExtraObjToLinkIntoBinary"><span class="hs-identifier hs-type">mkExtraObjToLinkIntoBinary</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span>
</span><span id="line-79"></span><span id="mkExtraObjToLinkIntoBinary"><span class="annot"><span class="annottext">mkExtraObjToLinkIntoBinary :: DynFlags -&gt; IO String
</span><a href="GHC.SysTools.ExtraObj.html#mkExtraObjToLinkIntoBinary"><span class="hs-identifier hs-var hs-var">mkExtraObjToLinkIntoBinary</span></a></span></span><span> </span><span id="local-6989586621681012560"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681012560"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-80"></span><span>  </span><span class="annot"><span class="annottext">Bool -&gt; IO () -&gt; IO ()
forall (f :: * -&gt; *). Applicative f =&gt; Bool -&gt; f () -&gt; f ()
</span><a href="../../base/src/GHC.Base.html#when"><span class="hs-identifier hs-var">when</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GeneralFlag -&gt; DynFlags -&gt; Bool
</span><a href="GHC.Driver.Session.html#gopt"><span class="hs-identifier hs-var">gopt</span></a></span><span> </span><span class="annot"><span class="annottext">GeneralFlag
</span><a href="GHC.Driver.Flags.html#Opt_NoHsMain"><span class="hs-identifier hs-var">Opt_NoHsMain</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681012560"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Bool
</span><a href="GHC.SysTools.ExtraObj.html#haveRtsOptsFlags"><span class="hs-identifier hs-var">haveRtsOptsFlags</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681012560"><span class="hs-identifier hs-var">dflags</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(IO () -&gt; IO ()) -&gt; IO () -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-81"></span><span>     </span><span class="annot"><span class="annottext">DynFlags -&gt; WarnReason -&gt; Severity -&gt; SrcSpan -&gt; MsgDoc -&gt; IO ()
</span><a href="GHC.Driver.Session.html#putLogMsg"><span class="hs-identifier hs-var">putLogMsg</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681012560"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">WarnReason
</span><a href="GHC.Driver.Flags.html#NoReason"><span class="hs-identifier hs-var">NoReason</span></a></span><span> </span><span class="annot"><span class="annottext">Severity
</span><a href="GHC.Utils.Error.html#SevInfo"><span class="hs-identifier hs-var">SevInfo</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="GHC.Types.SrcLoc.html#noSrcSpan"><span class="hs-identifier hs-var">noSrcSpan</span></a></span><span>
</span><span id="line-82"></span><span>         </span><span class="annot"><span class="annottext">(MsgDoc -&gt; IO ()) -&gt; MsgDoc -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">PprStyle -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#withPprStyle"><span class="hs-identifier hs-var">withPprStyle</span></a></span><span> </span><span class="annot"><span class="annottext">PprStyle
</span><a href="GHC.Utils.Outputable.html#defaultUserStyle"><span class="hs-identifier hs-var">defaultUserStyle</span></a></span><span>
</span><span id="line-83"></span><span>         </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Warning: -rtsopts and -with-rtsopts have no effect with -no-hs-main.&quot;</span></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span>
</span><span id="line-84"></span><span>          </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;    Call hs_init_ghc() from your main() function to set these options.&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-85"></span><span>
</span><span id="line-86"></span><span>  </span><span class="annot"><span class="annottext">DynFlags -&gt; String -&gt; String -&gt; IO String
</span><a href="GHC.SysTools.ExtraObj.html#mkExtraObj"><span class="hs-identifier hs-var">mkExtraObj</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681012560"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;c&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; MsgDoc -&gt; String
</span><a href="GHC.Utils.Outputable.html#showSDoc"><span class="hs-identifier hs-var">showSDoc</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681012560"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="#local-6989586621681012547"><span class="hs-identifier hs-var">main</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-87"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-88"></span><span>    </span><span id="local-6989586621681012547"><span class="annot"><span class="annottext">main :: MsgDoc
</span><a href="#local-6989586621681012547"><span class="hs-identifier hs-var hs-var">main</span></a></span></span><span>
</span><span id="line-89"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">GeneralFlag -&gt; DynFlags -&gt; Bool
</span><a href="GHC.Driver.Session.html#gopt"><span class="hs-identifier hs-var">gopt</span></a></span><span> </span><span class="annot"><span class="annottext">GeneralFlag
</span><a href="GHC.Driver.Flags.html#Opt_NoHsMain"><span class="hs-identifier hs-var">Opt_NoHsMain</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681012560"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="GHC.Utils.Outputable.html#empty"><span class="hs-identifier hs-var">Outputable.empty</span></a></span><span>
</span><span id="line-90"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-91"></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; GhcLink
</span><a href="GHC.Driver.Session.html#ghcLink"><span class="hs-identifier hs-var hs-var">ghcLink</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681012560"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-92"></span><span>                  </span><span class="annot"><span class="annottext">GhcLink
</span><a href="GHC.Driver.Session.html#LinkDynLib"><span class="hs-identifier hs-var">LinkDynLib</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Platform -&gt; OS
</span><a href="../../ghc-boot/src/GHC.Platform.html#platformOS"><span class="hs-identifier hs-var">platformOS</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; Platform
</span><a href="GHC.Driver.Session.html#targetPlatform"><span class="hs-identifier hs-var hs-var">targetPlatform</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681012560"><span class="hs-identifier hs-var">dflags</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">OS -&gt; OS -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">OS
</span><a href="../../ghc-boot/src/GHC.Platform.html#OSMinGW32"><span class="hs-identifier hs-var">OSMinGW32</span></a></span><span>
</span><span id="line-93"></span><span>                                    </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="#local-6989586621681012539"><span class="hs-identifier hs-var">dllMain</span></a></span><span>
</span><span id="line-94"></span><span>                                    </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="GHC.Utils.Outputable.html#empty"><span class="hs-identifier hs-var">Outputable.empty</span></a></span><span>
</span><span id="line-95"></span><span>                  </span><span class="annot"><span class="annottext">GhcLink
</span><span class="hs-identifier">_</span></span><span>                      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="#local-6989586621681012538"><span class="hs-identifier hs-var">exeMain</span></a></span><span>
</span><span id="line-96"></span><span>
</span><span id="line-97"></span><span>    </span><span id="local-6989586621681012538"><span class="annot"><span class="annottext">exeMain :: MsgDoc
</span><a href="#local-6989586621681012538"><span class="hs-identifier hs-var hs-var">exeMain</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[MsgDoc] -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span> </span><span class="hs-special">[</span><span>
</span><span id="line-98"></span><span>        </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;#include &lt;Rts.h&gt;&quot;</span></span><span class="hs-special">,</span><span>
</span><span id="line-99"></span><span>        </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;extern StgClosure ZCMain_main_closure;&quot;</span></span><span class="hs-special">,</span><span>
</span><span id="line-100"></span><span>        </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;int main(int argc, char *argv[])&quot;</span></span><span class="hs-special">,</span><span>
</span><span id="line-101"></span><span>        </span><span class="annot"><span class="annottext">Char -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#char"><span class="hs-identifier hs-var">char</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'{'</span></span><span class="hs-special">,</span><span>
</span><span id="line-102"></span><span>        </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot; RtsConfig __conf = defaultRtsConfig;&quot;</span></span><span class="hs-special">,</span><span>
</span><span id="line-103"></span><span>        </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot; __conf.rts_opts_enabled = &quot;</span></span><span>
</span><span id="line-104"></span><span>            </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RtsOptsEnabled -&gt; String
forall a. Show a =&gt; a -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var">show</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; RtsOptsEnabled
</span><a href="GHC.Driver.Session.html#rtsOptsEnabled"><span class="hs-identifier hs-var hs-var">rtsOptsEnabled</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681012560"><span class="hs-identifier hs-var">dflags</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="GHC.Utils.Outputable.html#semi"><span class="hs-identifier hs-var">semi</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-105"></span><span>        </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot; __conf.rts_opts_suggestions = &quot;</span></span><span>
</span><span id="line-106"></span><span>            </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Bool
</span><a href="GHC.Driver.Session.html#rtsOptsSuggestions"><span class="hs-identifier hs-var hs-var">rtsOptsSuggestions</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681012560"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-107"></span><span>                        </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;true&quot;</span></span><span>
</span><span id="line-108"></span><span>                        </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;false&quot;</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="GHC.Utils.Outputable.html#semi"><span class="hs-identifier hs-var">semi</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-109"></span><span>        </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;__conf.keep_cafs = &quot;</span></span><span>
</span><span id="line-110"></span><span>            </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">GeneralFlag -&gt; DynFlags -&gt; Bool
</span><a href="GHC.Driver.Session.html#gopt"><span class="hs-identifier hs-var">gopt</span></a></span><span> </span><span class="annot"><span class="annottext">GeneralFlag
</span><a href="GHC.Driver.Flags.html#Opt_KeepCAFs"><span class="hs-identifier hs-var">Opt_KeepCAFs</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681012560"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-111"></span><span>                       </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;true&quot;</span></span><span>
</span><span id="line-112"></span><span>                       </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;false&quot;</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="GHC.Utils.Outputable.html#semi"><span class="hs-identifier hs-var">semi</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-113"></span><span>        </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Maybe String
</span><a href="GHC.Driver.Session.html#rtsOpts"><span class="hs-identifier hs-var hs-var">rtsOpts</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681012560"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-114"></span><span>            </span><span class="annot"><span class="annottext">Maybe String
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="GHC.Utils.Outputable.html#empty"><span class="hs-identifier hs-var">Outputable.empty</span></a></span><span>
</span><span id="line-115"></span><span>            </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681012525"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681012525"><span class="hs-identifier hs-var">opts</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;    __conf.rts_opts= &quot;</span></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span>
</span><span id="line-116"></span><span>                          </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; String
forall a. Show a =&gt; a -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var">show</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681012525"><span class="hs-identifier hs-var">opts</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="GHC.Utils.Outputable.html#semi"><span class="hs-identifier hs-var">semi</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-117"></span><span>        </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot; __conf.rts_hs_main = true;&quot;</span></span><span class="hs-special">,</span><span>
</span><span id="line-118"></span><span>        </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot; return hs_main(argc,argv,&amp;ZCMain_main_closure,__conf);&quot;</span></span><span class="hs-special">,</span><span>
</span><span id="line-119"></span><span>        </span><span class="annot"><span class="annottext">Char -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#char"><span class="hs-identifier hs-var">char</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'}'</span></span><span class="hs-special">,</span><span>
</span><span id="line-120"></span><span>        </span><span class="annot"><span class="annottext">Char -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#char"><span class="hs-identifier hs-var">char</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'\n'</span></span><span> </span><span class="hs-comment">-- final newline, to keep gcc happy</span><span>
</span><span id="line-121"></span><span>        </span><span class="hs-special">]</span><span>
</span><span id="line-122"></span><span>
</span><span id="line-123"></span><span>    </span><span id="local-6989586621681012539"><span class="annot"><span class="annottext">dllMain :: MsgDoc
</span><a href="#local-6989586621681012539"><span class="hs-identifier hs-var hs-var">dllMain</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[MsgDoc] -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span> </span><span class="hs-special">[</span><span>
</span><span id="line-124"></span><span>        </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;#include &lt;Rts.h&gt;&quot;</span></span><span class="hs-special">,</span><span>
</span><span id="line-125"></span><span>        </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;#include &lt;windows.h&gt;&quot;</span></span><span class="hs-special">,</span><span>
</span><span id="line-126"></span><span>        </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;#include &lt;stdbool.h&gt;&quot;</span></span><span class="hs-special">,</span><span>
</span><span id="line-127"></span><span>        </span><span class="annot"><span class="annottext">Char -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#char"><span class="hs-identifier hs-var">char</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'\n'</span></span><span class="hs-special">,</span><span>
</span><span id="line-128"></span><span>        </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;bool&quot;</span></span><span class="hs-special">,</span><span>
</span><span id="line-129"></span><span>        </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;WINAPI&quot;</span></span><span class="hs-special">,</span><span>
</span><span id="line-130"></span><span>        </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;DllMain ( HINSTANCE hInstance STG_UNUSED&quot;</span></span><span class="hs-special">,</span><span>
</span><span id="line-131"></span><span>        </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;        , DWORD reason STG_UNUSED&quot;</span></span><span class="hs-special">,</span><span>
</span><span id="line-132"></span><span>        </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;        , LPVOID reserved STG_UNUSED&quot;</span></span><span class="hs-special">,</span><span>
</span><span id="line-133"></span><span>        </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;        )&quot;</span></span><span class="hs-special">,</span><span>
</span><span id="line-134"></span><span>        </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;{&quot;</span></span><span class="hs-special">,</span><span>
</span><span id="line-135"></span><span>        </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;  return true;&quot;</span></span><span class="hs-special">,</span><span>
</span><span id="line-136"></span><span>        </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;}&quot;</span></span><span class="hs-special">,</span><span>
</span><span id="line-137"></span><span>        </span><span class="annot"><span class="annottext">Char -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#char"><span class="hs-identifier hs-var">char</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'\n'</span></span><span> </span><span class="hs-comment">-- final newline, to keep gcc happy</span><span>
</span><span id="line-138"></span><span>        </span><span class="hs-special">]</span><span>
</span><span id="line-139"></span><span>
</span><span id="line-140"></span><span class="hs-comment">-- Write out the link info section into a new assembly file. Previously</span><span>
</span><span id="line-141"></span><span class="hs-comment">-- this was included as inline assembly in the main.c file but this</span><span>
</span><span id="line-142"></span><span class="hs-comment">-- is pretty fragile. gas gets upset trying to calculate relative offsets</span><span>
</span><span id="line-143"></span><span class="hs-comment">-- that span the .note section (notably .text) when debug info is present</span><span>
</span><span id="line-144"></span><span class="annot"><a href="GHC.SysTools.ExtraObj.html#mkNoteObjsToLinkIntoBinary"><span class="hs-identifier hs-type">mkNoteObjsToLinkIntoBinary</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Unit.Types.html#UnitId"><span class="hs-identifier hs-type">UnitId</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-145"></span><span id="mkNoteObjsToLinkIntoBinary"><span class="annot"><span class="annottext">mkNoteObjsToLinkIntoBinary :: DynFlags -&gt; [UnitId] -&gt; IO [String]
</span><a href="GHC.SysTools.ExtraObj.html#mkNoteObjsToLinkIntoBinary"><span class="hs-identifier hs-var hs-var">mkNoteObjsToLinkIntoBinary</span></a></span></span><span> </span><span id="local-6989586621681012524"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681012524"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621681012523"><span class="annot"><span class="annottext">[UnitId]
</span><a href="#local-6989586621681012523"><span class="hs-identifier hs-var">dep_packages</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-146"></span><span>   </span><span id="local-6989586621681012522"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681012522"><span class="hs-identifier hs-var">link_info</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; [UnitId] -&gt; IO String
</span><a href="GHC.SysTools.ExtraObj.html#getLinkInfo"><span class="hs-identifier hs-var">getLinkInfo</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681012524"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">[UnitId]
</span><a href="#local-6989586621681012523"><span class="hs-identifier hs-var">dep_packages</span></a></span><span>
</span><span id="line-147"></span><span>
</span><span id="line-148"></span><span>   </span><span class="hs-keyword">if</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">OS -&gt; Bool
</span><a href="GHC.SysTools.ExtraObj.html#platformSupportsSavingLinkOpts"><span class="hs-identifier hs-var">platformSupportsSavingLinkOpts</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; OS
</span><a href="../../ghc-boot/src/GHC.Platform.html#platformOS"><span class="hs-identifier hs-var">platformOS</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681012521"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-149"></span><span>     </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">(String -&gt; [String]) -&gt; IO String -&gt; IO [String]
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; [String] -&gt; [String]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(IO String -&gt; IO [String]) -&gt; IO String -&gt; IO [String]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; String -&gt; String -&gt; IO String
</span><a href="GHC.SysTools.ExtraObj.html#mkExtraObj"><span class="hs-identifier hs-var">mkExtraObj</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681012524"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;s&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; MsgDoc -&gt; String
</span><a href="GHC.Utils.Outputable.html#showSDoc"><span class="hs-identifier hs-var">showSDoc</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681012524"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="#local-6989586621681012520"><span class="hs-identifier hs-var">link_opts</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681012522"><span class="hs-identifier hs-var">link_info</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-150"></span><span>     </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">[String] -&gt; IO [String]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-151"></span><span>
</span><span id="line-152"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-153"></span><span>    </span><span id="local-6989586621681012521"><span class="annot"><span class="annottext">platform :: Platform
</span><a href="#local-6989586621681012521"><span class="hs-identifier hs-var hs-var">platform</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Platform
</span><a href="GHC.Driver.Session.html#targetPlatform"><span class="hs-identifier hs-var hs-var">targetPlatform</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681012524"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-154"></span><span>    </span><span id="local-6989586621681012520"><span class="annot"><span class="annottext">link_opts :: String -&gt; MsgDoc
</span><a href="#local-6989586621681012520"><span class="hs-identifier hs-var hs-var">link_opts</span></a></span></span><span> </span><span id="local-6989586621681012517"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681012517"><span class="hs-identifier hs-var">info</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[MsgDoc] -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#hcat"><span class="hs-identifier hs-var">hcat</span></a></span><span> </span><span class="hs-special">[</span><span>
</span><span id="line-155"></span><span>      </span><span class="hs-comment">-- &quot;link info&quot; section (see Note [LinkInfo section])</span><span>
</span><span id="line-156"></span><span>      </span><span class="annot"><span class="annottext">Platform -&gt; String -&gt; String -&gt; Word32 -&gt; String -&gt; MsgDoc
</span><a href="GHC.SysTools.Elf.html#makeElfNote"><span class="hs-identifier hs-var">makeElfNote</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681012521"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="GHC.SysTools.ExtraObj.html#ghcLinkInfoSectionName"><span class="hs-identifier hs-var">ghcLinkInfoSectionName</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="GHC.SysTools.ExtraObj.html#ghcLinkInfoNoteName"><span class="hs-identifier hs-var">ghcLinkInfoNoteName</span></a></span><span> </span><span class="annot"><span class="annottext">Word32
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681012517"><span class="hs-identifier hs-var">info</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-157"></span><span>
</span><span id="line-158"></span><span>      </span><span class="hs-comment">-- ALL generated assembly must have this section to disable</span><span>
</span><span id="line-159"></span><span>      </span><span class="hs-comment">-- executable stacks.  See also</span><span>
</span><span id="line-160"></span><span>      </span><span class="hs-comment">-- &quot;GHC.CmmToAsm&quot; for another instance</span><span>
</span><span id="line-161"></span><span>      </span><span class="hs-comment">-- where we need to do this.</span><span>
</span><span id="line-162"></span><span>      </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Platform -&gt; Bool
</span><a href="../../ghc-boot/src/GHC.Platform.html#platformHasGnuNonexecStack"><span class="hs-identifier hs-var hs-var">platformHasGnuNonexecStack</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681012521"><span class="hs-identifier hs-var">platform</span></a></span><span>
</span><span id="line-163"></span><span>        </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;.section .note.GNU-stack,\&quot;\&quot;,&quot;</span></span><span>
</span><span id="line-164"></span><span>             </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Platform -&gt; String -&gt; MsgDoc
</span><a href="GHC.Utils.Asm.html#sectionType"><span class="hs-identifier hs-var">sectionType</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681012521"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;progbits&quot;</span></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#char"><span class="hs-identifier hs-var">char</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'\n'</span></span><span>
</span><span id="line-165"></span><span>        </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="GHC.Utils.Outputable.html#empty"><span class="hs-identifier hs-var">Outputable.empty</span></a></span><span>
</span><span id="line-166"></span><span>      </span><span class="hs-special">]</span><span>
</span><span id="line-167"></span><span>
</span><span id="line-168"></span><span class="hs-comment">-- | Return the &quot;link info&quot; string</span><span>
</span><span id="line-169"></span><span class="hs-comment">--</span><span>
</span><span id="line-170"></span><span class="hs-comment">-- See Note [LinkInfo section]</span><span>
</span><span id="line-171"></span><span class="annot"><a href="GHC.SysTools.ExtraObj.html#getLinkInfo"><span class="hs-identifier hs-type">getLinkInfo</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Unit.Types.html#UnitId"><span class="hs-identifier hs-type">UnitId</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>
</span><span id="line-172"></span><span id="getLinkInfo"><span class="annot"><span class="annottext">getLinkInfo :: DynFlags -&gt; [UnitId] -&gt; IO String
</span><a href="GHC.SysTools.ExtraObj.html#getLinkInfo"><span class="hs-identifier hs-var hs-var">getLinkInfo</span></a></span></span><span> </span><span id="local-6989586621681012512"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681012512"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621681012511"><span class="annot"><span class="annottext">[UnitId]
</span><a href="#local-6989586621681012511"><span class="hs-identifier hs-var">dep_packages</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-173"></span><span>   </span><span id="local-6989586621681012510"><span class="annot"><span class="annottext">([String], [String], [String])
</span><a href="#local-6989586621681012510"><span class="hs-identifier hs-var">package_link_opts</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; [UnitId] -&gt; IO ([String], [String], [String])
</span><a href="GHC.Unit.State.html#getUnitLinkOpts"><span class="hs-identifier hs-var">getUnitLinkOpts</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681012512"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">[UnitId]
</span><a href="#local-6989586621681012511"><span class="hs-identifier hs-var">dep_packages</span></a></span><span>
</span><span id="line-174"></span><span>   </span><span id="local-6989586621681012508"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681012508"><span class="hs-identifier hs-var">pkg_frameworks</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Platform -&gt; Bool
</span><a href="../../ghc-boot/src/GHC.Platform.html#platformUsesFrameworks"><span class="hs-identifier hs-var">platformUsesFrameworks</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; Platform
</span><a href="GHC.Driver.Session.html#targetPlatform"><span class="hs-identifier hs-var hs-var">targetPlatform</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681012512"><span class="hs-identifier hs-var">dflags</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-175"></span><span>                     </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; [UnitId] -&gt; IO [String]
</span><a href="GHC.Unit.State.html#getUnitFrameworks"><span class="hs-identifier hs-var">getUnitFrameworks</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681012512"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">[UnitId]
</span><a href="#local-6989586621681012511"><span class="hs-identifier hs-var">dep_packages</span></a></span><span>
</span><span id="line-176"></span><span>                     </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">[String] -&gt; IO [String]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-177"></span><span>   </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681012505"><span class="annot"><span class="annottext">extra_ld_inputs :: [Option]
</span><a href="#local-6989586621681012505"><span class="hs-identifier hs-var hs-var">extra_ld_inputs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; [Option]
</span><a href="GHC.Driver.Session.html#ldInputs"><span class="hs-identifier hs-var hs-var">ldInputs</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681012512"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-178"></span><span>   </span><span class="hs-keyword">let</span><span>
</span><span id="line-179"></span><span>      </span><span id="local-6989586621681012503"><span class="annot"><span class="annottext">link_info :: (([String], [String], [String]), [String], Maybe String,
 RtsOptsEnabled, Bool, [String], [String])
</span><a href="#local-6989586621681012503"><span class="hs-identifier hs-var hs-var">link_info</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">([String], [String], [String])
</span><a href="#local-6989586621681012510"><span class="hs-identifier hs-var">package_link_opts</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-180"></span><span>                   </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681012508"><span class="hs-identifier hs-var">pkg_frameworks</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-181"></span><span>                   </span><span class="annot"><span class="annottext">DynFlags -&gt; Maybe String
</span><a href="GHC.Driver.Session.html#rtsOpts"><span class="hs-identifier hs-var hs-var">rtsOpts</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681012512"><span class="hs-identifier hs-var">dflags</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-182"></span><span>                   </span><span class="annot"><span class="annottext">DynFlags -&gt; RtsOptsEnabled
</span><a href="GHC.Driver.Session.html#rtsOptsEnabled"><span class="hs-identifier hs-var hs-var">rtsOptsEnabled</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681012512"><span class="hs-identifier hs-var">dflags</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-183"></span><span>                   </span><span class="annot"><span class="annottext">GeneralFlag -&gt; DynFlags -&gt; Bool
</span><a href="GHC.Driver.Session.html#gopt"><span class="hs-identifier hs-var">gopt</span></a></span><span> </span><span class="annot"><span class="annottext">GeneralFlag
</span><a href="GHC.Driver.Flags.html#Opt_NoHsMain"><span class="hs-identifier hs-var">Opt_NoHsMain</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681012512"><span class="hs-identifier hs-var">dflags</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-184"></span><span>                   </span><span class="annot"><span class="annottext">(Option -&gt; String) -&gt; [Option] -&gt; [String]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Option -&gt; String
</span><a href="GHC.Utils.CliOption.html#showOpt"><span class="hs-identifier hs-var">showOpt</span></a></span><span> </span><span class="annot"><span class="annottext">[Option]
</span><a href="#local-6989586621681012505"><span class="hs-identifier hs-var">extra_ld_inputs</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-185"></span><span>                   </span><span class="annot"><span class="annottext">DynFlags -&gt; (DynFlags -&gt; [String]) -&gt; [String]
forall a. DynFlags -&gt; (DynFlags -&gt; [a]) -&gt; [a]
</span><a href="GHC.Driver.Session.html#getOpts"><span class="hs-identifier hs-var">getOpts</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681012512"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; [String]
</span><a href="GHC.Driver.Session.html#opt_l"><span class="hs-identifier hs-var">opt_l</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-186"></span><span>   </span><span class="hs-comment">--</span><span>
</span><span id="line-187"></span><span>   </span><span class="annot"><span class="annottext">String -&gt; IO String
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(([String], [String], [String]), [String], Maybe String,
 RtsOptsEnabled, Bool, [String], [String])
-&gt; String
forall a. Show a =&gt; a -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var">show</span></a></span><span> </span><span class="annot"><span class="annottext">(([String], [String], [String]), [String], Maybe String,
 RtsOptsEnabled, Bool, [String], [String])
</span><a href="#local-6989586621681012503"><span class="hs-identifier hs-var">link_info</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-188"></span><span>
</span><span id="line-189"></span><span class="annot"><a href="GHC.SysTools.ExtraObj.html#platformSupportsSavingLinkOpts"><span class="hs-identifier hs-type">platformSupportsSavingLinkOpts</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-boot/src/GHC.Platform.html#OS"><span class="hs-identifier hs-type">OS</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-190"></span><span id="platformSupportsSavingLinkOpts"><span class="annot"><span class="annottext">platformSupportsSavingLinkOpts :: OS -&gt; Bool
</span><a href="GHC.SysTools.ExtraObj.html#platformSupportsSavingLinkOpts"><span class="hs-identifier hs-var hs-var">platformSupportsSavingLinkOpts</span></a></span></span><span> </span><span id="local-6989586621681012499"><span class="annot"><span class="annottext">OS
</span><a href="#local-6989586621681012499"><span class="hs-identifier hs-var">os</span></a></span></span><span>
</span><span id="line-191"></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">OS
</span><a href="#local-6989586621681012499"><span class="hs-identifier hs-var">os</span></a></span><span> </span><span class="annot"><span class="annottext">OS -&gt; OS -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">OS
</span><a href="../../ghc-boot/src/GHC.Platform.html#OSSolaris2"><span class="hs-identifier hs-var">OSSolaris2</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="hs-comment">-- see #5382</span><span>
</span><span id="line-192"></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OS -&gt; Bool
</span><a href="../../ghc-boot/src/GHC.Platform.html#osElfTarget"><span class="hs-identifier hs-var">osElfTarget</span></a></span><span> </span><span class="annot"><span class="annottext">OS
</span><a href="#local-6989586621681012499"><span class="hs-identifier hs-var">os</span></a></span><span>
</span><span id="line-193"></span><span>
</span><span id="line-194"></span><span class="hs-comment">-- See Note [LinkInfo section]</span><span>
</span><span id="line-195"></span><span class="annot"><a href="GHC.SysTools.ExtraObj.html#ghcLinkInfoSectionName"><span class="hs-identifier hs-type">ghcLinkInfoSectionName</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>
</span><span id="line-196"></span><span id="ghcLinkInfoSectionName"><span class="annot"><span class="annottext">ghcLinkInfoSectionName :: String
</span><a href="GHC.SysTools.ExtraObj.html#ghcLinkInfoSectionName"><span class="hs-identifier hs-var hs-var">ghcLinkInfoSectionName</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;.debug-ghc-link-info&quot;</span></span><span>
</span><span id="line-197"></span><span>  </span><span class="hs-comment">-- if we use the &quot;.debug&quot; prefix, then strip will strip it by default</span><span>
</span><span id="line-198"></span><span>
</span><span id="line-199"></span><span class="hs-comment">-- Identifier for the note (see Note [LinkInfo section])</span><span>
</span><span id="line-200"></span><span class="annot"><a href="GHC.SysTools.ExtraObj.html#ghcLinkInfoNoteName"><span class="hs-identifier hs-type">ghcLinkInfoNoteName</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>
</span><span id="line-201"></span><span id="ghcLinkInfoNoteName"><span class="annot"><span class="annottext">ghcLinkInfoNoteName :: String
</span><a href="GHC.SysTools.ExtraObj.html#ghcLinkInfoNoteName"><span class="hs-identifier hs-var hs-var">ghcLinkInfoNoteName</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;GHC link info&quot;</span></span><span>
</span><span id="line-202"></span><span>
</span><span id="line-203"></span><span class="hs-comment">-- Returns 'False' if it was, and we can avoid linking, because the</span><span>
</span><span id="line-204"></span><span class="hs-comment">-- previous binary was linked with &quot;the same options&quot;.</span><span>
</span><span id="line-205"></span><span class="annot"><a href="GHC.SysTools.ExtraObj.html#checkLinkInfo"><span class="hs-identifier hs-type">checkLinkInfo</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Unit.Types.html#UnitId"><span class="hs-identifier hs-type">UnitId</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-206"></span><span id="checkLinkInfo"><span class="annot"><span class="annottext">checkLinkInfo :: DynFlags -&gt; [UnitId] -&gt; String -&gt; IO Bool
</span><a href="GHC.SysTools.ExtraObj.html#checkLinkInfo"><span class="hs-identifier hs-var hs-var">checkLinkInfo</span></a></span></span><span> </span><span id="local-6989586621681012496"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681012496"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621681012495"><span class="annot"><span class="annottext">[UnitId]
</span><a href="#local-6989586621681012495"><span class="hs-identifier hs-var">pkg_deps</span></a></span></span><span> </span><span id="local-6989586621681012494"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681012494"><span class="hs-identifier hs-var">exe_file</span></a></span></span><span>
</span><span id="line-207"></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">OS -&gt; Bool
</span><a href="GHC.SysTools.ExtraObj.html#platformSupportsSavingLinkOpts"><span class="hs-identifier hs-var">platformSupportsSavingLinkOpts</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; OS
</span><a href="../../ghc-boot/src/GHC.Platform.html#platformOS"><span class="hs-identifier hs-var">platformOS</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; Platform
</span><a href="GHC.Driver.Session.html#targetPlatform"><span class="hs-identifier hs-var hs-var">targetPlatform</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681012496"><span class="hs-identifier hs-var">dflags</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-208"></span><span> </span><span class="hs-comment">-- ToDo: Windows and OS X do not use the ELF binary format, so</span><span>
</span><span id="line-209"></span><span> </span><span class="hs-comment">-- readelf does not work there.  We need to find another way to do</span><span>
</span><span id="line-210"></span><span> </span><span class="hs-comment">-- this.</span><span>
</span><span id="line-211"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; IO Bool
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="hs-comment">-- conservatively we should return True, but not</span><span>
</span><span id="line-212"></span><span>                </span><span class="hs-comment">-- linking in this case was the behaviour for a long</span><span>
</span><span id="line-213"></span><span>                </span><span class="hs-comment">-- time so we leave it as-is.</span><span>
</span><span id="line-214"></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-215"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-216"></span><span>   </span><span id="local-6989586621681012492"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681012492"><span class="hs-identifier hs-var">link_info</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; [UnitId] -&gt; IO String
</span><a href="GHC.SysTools.ExtraObj.html#getLinkInfo"><span class="hs-identifier hs-var">getLinkInfo</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681012496"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">[UnitId]
</span><a href="#local-6989586621681012495"><span class="hs-identifier hs-var">pkg_deps</span></a></span><span>
</span><span id="line-217"></span><span>   </span><span class="annot"><span class="annottext">DynFlags -&gt; Int -&gt; MsgDoc -&gt; IO ()
</span><a href="GHC.Utils.Error.html#debugTraceMsg"><span class="hs-identifier hs-var">debugTraceMsg</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681012496"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">3</span></span><span> </span><span class="annot"><span class="annottext">(MsgDoc -&gt; IO ()) -&gt; MsgDoc -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Link info: &quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681012492"><span class="hs-identifier hs-var">link_info</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-218"></span><span>   </span><span id="local-6989586621681012490"><span class="annot"><span class="annottext">Maybe String
</span><a href="#local-6989586621681012490"><span class="hs-identifier hs-var">m_exe_link_info</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; String -&gt; String -&gt; String -&gt; IO (Maybe String)
</span><a href="GHC.SysTools.Elf.html#readElfNoteAsString"><span class="hs-identifier hs-var">readElfNoteAsString</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681012496"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681012494"><span class="hs-identifier hs-var">exe_file</span></a></span><span>
</span><span id="line-219"></span><span>                          </span><span class="annot"><span class="annottext">String
</span><a href="GHC.SysTools.ExtraObj.html#ghcLinkInfoSectionName"><span class="hs-identifier hs-var">ghcLinkInfoSectionName</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="GHC.SysTools.ExtraObj.html#ghcLinkInfoNoteName"><span class="hs-identifier hs-var">ghcLinkInfoNoteName</span></a></span><span>
</span><span id="line-220"></span><span>   </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681012484"><span class="annot"><span class="annottext">sameLinkInfo :: Bool
</span><a href="#local-6989586621681012484"><span class="hs-identifier hs-var hs-var">sameLinkInfo</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; Maybe String
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681012492"><span class="hs-identifier hs-var">link_info</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe String -&gt; Maybe String -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Maybe String
</span><a href="#local-6989586621681012490"><span class="hs-identifier hs-var">m_exe_link_info</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-221"></span><span>   </span><span class="annot"><span class="annottext">DynFlags -&gt; Int -&gt; MsgDoc -&gt; IO ()
</span><a href="GHC.Utils.Error.html#debugTraceMsg"><span class="hs-identifier hs-var">debugTraceMsg</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681012496"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">3</span></span><span> </span><span class="annot"><span class="annottext">(MsgDoc -&gt; IO ()) -&gt; MsgDoc -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe String
</span><a href="#local-6989586621681012490"><span class="hs-identifier hs-var">m_exe_link_info</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-222"></span><span>     </span><span class="annot"><span class="annottext">Maybe String
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Exe link info: Not found&quot;</span></span><span>
</span><span id="line-223"></span><span>     </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681012483"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681012483"><span class="hs-identifier hs-var">s</span></a></span></span><span>
</span><span id="line-224"></span><span>       </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681012484"><span class="hs-identifier hs-var">sameLinkInfo</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Exe link info is the same&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-225"></span><span>       </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Exe link info is different: &quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681012483"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-226"></span><span>   </span><span class="annot"><span class="annottext">Bool -&gt; IO Bool
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681012484"><span class="hs-identifier hs-var">sameLinkInfo</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-227"></span><span>
</span><span id="line-228"></span><span class="hs-comment">{- Note [LinkInfo section]
   ~~~~~~~~~~~~~~~~~~~~~~~

The &quot;link info&quot; is a string representing the parameters of the link. We save
this information in the binary, and the next time we link, if nothing else has
changed, we use the link info stored in the existing binary to decide whether
to re-link or not.

The &quot;link info&quot; string is stored in a ELF section called &quot;.debug-ghc-link-info&quot;
(see ghcLinkInfoSectionName) with the SHT_NOTE type.  For some time, it used to
not follow the specified record-based format (see #11022).

-}</span><span>
</span><span id="line-241"></span><span>
</span><span id="line-242"></span><span class="annot"><a href="GHC.SysTools.ExtraObj.html#haveRtsOptsFlags"><span class="hs-identifier hs-type">haveRtsOptsFlags</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-243"></span><span id="haveRtsOptsFlags"><span class="annot"><span class="annottext">haveRtsOptsFlags :: DynFlags -&gt; Bool
</span><a href="GHC.SysTools.ExtraObj.html#haveRtsOptsFlags"><span class="hs-identifier hs-var hs-var">haveRtsOptsFlags</span></a></span></span><span> </span><span id="local-6989586621681012482"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681012482"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-244"></span><span>        </span><span class="annot"><span class="annottext">Maybe String -&gt; Bool
forall a. Maybe a -&gt; Bool
</span><a href="../../base/src/Data.Maybe.html#isJust"><span class="hs-identifier hs-var">isJust</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; Maybe String
</span><a href="GHC.Driver.Session.html#rtsOpts"><span class="hs-identifier hs-var hs-var">rtsOpts</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681012482"><span class="hs-identifier hs-var">dflags</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; RtsOptsEnabled
</span><a href="GHC.Driver.Session.html#rtsOptsEnabled"><span class="hs-identifier hs-var hs-var">rtsOptsEnabled</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681012482"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-245"></span><span>                                       </span><span class="annot"><span class="annottext">RtsOptsEnabled
</span><a href="GHC.Driver.Session.html#RtsOptsSafeOnly"><span class="hs-identifier hs-var">RtsOptsSafeOnly</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-246"></span><span>                                       </span><span class="annot"><span class="annottext">RtsOptsEnabled
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-247"></span></pre></body></html>